<?php
/**
 * Created by PhpStorm.
 * User: zhangligang
 * Date: 17/4/22
 * Time: 下午2:21
 */

namespace App\Http\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * 店铺
 * Class Store
 * @package App\Http\Models
 */
class Store extends Model
{
    /**
     * table name
     * @var string
     */
    protected $table = 'app_store';

    protected $fillable = ['*'];

    /**
     * 关联卖家地址
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function sellerAddress()
    {
        return $this->hasOne('App\Http\Models\SellerAddress', 'store_id', 'id');
    }

    /**
     * 关联卖家
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function seller()
    {
        return $this->belongsTo('App\Http\Models\User', 'seller_id');
    }

}